package com.kwok.cloud.cls.application.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/class")
public class ClassController {

    @Value("${server.port}")
    private Integer port;

    @GetMapping("/get")
    public String getCls(String sname){
        String result = switch (sname){
            case "张三" -> "软件工程一班";
            case "李四" -> "软件工程二班";
            default -> {
                try {
                    Thread.sleep(60000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                yield  "该生不是软件工程专业学生";
            }
        };
        System.out.println("查询"+sname+"的班级信息");
        return result+port;
    }

}
